/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qsdm.es.persistence;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alberto
 */
@Entity
@Table(name = "competencia", catalog = "qsdm", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Competencia.findAll", query = "SELECT c FROM Competencia c"),
    @NamedQuery(name = "Competencia.findById", query = "SELECT c FROM Competencia c WHERE c.id = :id"),
    @NamedQuery(name = "Competencia.findByCodigo", query = "SELECT c FROM Competencia c WHERE c.codigo = :codigo"),
    @NamedQuery(name = "Competencia.findByNombre", query = "SELECT c FROM Competencia c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Competencia.findByDocumentoSporte", query = "SELECT c FROM Competencia c WHERE c.documentoSporte = :documentoSporte"),
    @NamedQuery(name = "Competencia.findByGnerica", query = "SELECT c FROM Competencia c WHERE c.gnerica = :gnerica")})
public class Competencia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Column(name = "codigo", length = 256)
    private String codigo;
    @Column(name = "nombre", length = 256)
    private String nombre;
    @Column(name = "documentoSporte", length = 512)
    private String documentoSporte;
    @Column(name = "gnerica")
    private Boolean gnerica;
    @Lob
    @Column(name = "descripcion", length = 65535)
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "competencia1", fetch = FetchType.LAZY)
    private List<Profesioncompetencia> profesioncompetenciaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "competencia1", fetch = FetchType.LAZY)
    private List<Usuariocompetencia> usuariocompetenciaList;

    public Competencia() {
    }

    public Competencia(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDocumentoSporte() {
        return documentoSporte;
    }

    public void setDocumentoSporte(String documentoSporte) {
        this.documentoSporte = documentoSporte;
    }

    public Boolean getGnerica() {
        return gnerica;
    }

    public void setGnerica(Boolean gnerica) {
        this.gnerica = gnerica;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public List<Profesioncompetencia> getProfesioncompetenciaList() {
        return profesioncompetenciaList;
    }

    public void setProfesioncompetenciaList(List<Profesioncompetencia> profesioncompetenciaList) {
        this.profesioncompetenciaList = profesioncompetenciaList;
    }

    @XmlTransient
    public List<Usuariocompetencia> getUsuariocompetenciaList() {
        return usuariocompetenciaList;
    }

    public void setUsuariocompetenciaList(List<Usuariocompetencia> usuariocompetenciaList) {
        this.usuariocompetenciaList = usuariocompetenciaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Competencia)) {
            return false;
        }
        Competencia other = (Competencia) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsdm.es.persistence.Competencia[ id=" + id + " ]";
    }
    
}
